/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;

/**
 *
 * @author Admin
 */
@Entity
public class Book implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    protected String title;
    protected String author;
    @ManyToOne(fetch=FetchType.EAGER)
    protected Shelf shelf;

    /**
     * Get the value of shelf
     *
     * @return the value of shelf
     */
    public Shelf getShelf() {
        return shelf;
    }

    /**
     * Set the value of shelf
     *
     * @param shelf new value of shelf
     */
    public void setShelf(Shelf shelf) {
        this.shelf = shelf;
    }


    /**
     * Get the value of Author
     *
     * @return the value of Author
     */
    public String getAuthor() {
        return author;
    }

    /**
     * Set the value of Author
     *
     * @param Author new value of Author
     */
    public void setAuthor(String Author) {
        this.author = Author;
    }


    /**
     * Get the value of Name
     *
     * @return the value of Name
     */
    public String getName() {
        return title;
    }

    /**
     * Set the value of Name
     *
     * @param Name new value of Name
     */
    public void setName(String Name) {
        this.title = Name;
    }


    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Book)) {
            return false;
        }
        Book other = (Book) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Book[ id=" + id + " ]";
    }
    
}
